<template>
  <div>
    <div class="periphery_select">
      <div class="periphery_category">
        <div class="periphery_category_title">分类</div>
        <div class="periphery_category_item">
          <span>箱包服鞋</span>
          <span>家居日用</span>
          <span>文创周边</span>
          <span>穿搭周边</span>
          <span>立绘周边</span>
          <span>元素配件</span>
          <span>挂件摆件</span>
          <span>3C周边</span>
          <span>耳机</span>
          <span>毛绒玩偶</span>
          <span>印刷品</span>
        </div>
      </div>
      <div class="periphery_creen">
        <div class="periphery_creen_title">筛选</div>
        <div class="periphery_creen_item">
          <span>综合</span>
          <span>销量</span>
          <span>价格</span>
        </div>
      </div>
    </div>
    <div class="periphery_body">
      <div
        :class="`periphery_body_item ${index % 4 === 3 ? 'nomargin' : ''}`"
        v-for="(periphery, index) in peripheryList"
        :key="periphery.id"
      >
        <div class="body_item_img">
          <img :src="periphery.itemsImg" width="100%" alt="" />
        </div>
        <div class="body_item_title">
          {{ periphery.name }}
        </div>
        <div class="body_item_price">
          <span class="price_icon">{{ periphery.priceSymbol }}</span>
          <span class="price_num">{{ periphery.price }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import mockAjax from "../api";
export default {
  name: "VipShopPeriphery",
  data() {
    return {
      peripheryList: [],
    };
  },
  mounted() {
    this.getPeripheryList();
  },
  methods: {
    async getPeripheryList() {
      const res = await mockAjax({
        url: "/periphery",
        method: "get",
      });
      this.peripheryList = res.data.data.data.list.map((item) => {
        return {
          itemsImg: item.itemsImg,
          name: item.name,
          price: item.price,
          priceSymbol: item.priceSymbol,
          id: item.itemsId,
        };
      });
      // console.log(res);
    },
  },
};
</script>

<style lang="less" scoped>
.periphery_select {
  height: 125px;
  width: 100%;
  background-color: #fff;
  padding-bottom: 20px;
}
.periphery_category,
.periphery_creen {
  margin: 0 auto;
  width: 1160px;
  height: 64px;

  display: flex;
  align-items: center;
  border: 1px solid #d8d8d8;
}
.periphery_creen {
  border-top: none;
}
.periphery_category_title,
.periphery_creen_title {
  width: 90px;
  height: 100%;
  background-color: #f4f4f4;
  text-align: center;
  line-height: 60px;
  //   border: 1px solid #d8d8d8;
  border-right: none;
  font-size: 14px;
  color: #222;
}
.periphery_category_item,
.periphery_creen_item {
  width: 1070px;
  height: 100%;
  text-align: left;
  line-height: 60px;
  box-sizing: border-box;
  //   border: 1px solid #d8d8d8;
  border-bottom: none;
}
.periphery_category_item > span,
.periphery_creen_item > span {
  margin: 8px 0;
  margin-left: 32px;
  font-size: 14px;
  color: #222;
  cursor: pointer;
}

/****************************************** body ***********************************/
.periphery_body {
  width: 1160px;
  padding-top: 32px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
}
.periphery_body_item {
  margin-right: 24px;
  margin-bottom: 24px;
  width: 272px;
  height: 360px;
  background-color: #fff;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: 2px 4px 8px rgb(0 0 0 / 10%);
  overflow: hidden;
}
.periphery_body .nomargin {
  margin-right: 0;
}
.body_item_img {
  width: 100%;
  height: 272px;
}
.body_item_title {
  margin: 8px 12px;
  font-size: 16px;
  color: #222;
}
.body_item_price {
  height: 20px;
  padding-left: 12px;
  font-weight: 700;
  color: #fb7299;
  .price_icon {
    font-size: 14px;
    padding-top: 3px;
  }
  .price_num {
    font-size: 22px;
    line-height: 22px;
  }
}
</style>
